<template>
  <div class="mui-pages record-member-lists">
    <header class="mui-bar mui-bar-nav">
      <div class="header-common-title flex-justify-start">
        <div class="mui-action-back"><img @click="fn.back()" class="back-btn" src="../../../../static/images/back.png"></div>
        <div class="header-search flex-center">申请补开详情</div>
      </div>
    </header>
    <div class="mui-scroll-wrapper">
      <div class="mui-scroll paddingBottom">
        <ul class="mui-table-view meeting-editor-lists">
          <li class="mui-table-view-cell flex-between-center">
            <b>学习主题：</b>
            <span class="mine-lists-content">{{data.subject}}</span>
          </li>
          <li class="mui-table-view-cell flex-between-center">
            <b>原学习时间：</b>
            <span class="mine-lists-content">{{fn.formatDate(data.beforeBeginTime)}}至{{fn.formatDate(data.beforeEndTime)}}</span>
          </li>
          <li class="mui-table-view-cell flex-between-center">
            <b>申请支部：</b>
            <span class="mine-lists-content">{{data.partyGorupName}}</span>
          </li>
          <li class="mui-table-view-cell flex-between-center">
            <b>申请人：</b>
            <span class="mine-lists-content">{{data.createByName}}</span>
          </li>
          <li class="mui-table-view-cell flex-between-center">
            <b>补开时间：</b>
            <span class="mine-lists-content">{{fn.formatDate(data.patchupTime)}}</span>
          </li>
          <li class="mui-table-view-cell">
            <b>补开原因：</b>
            <p class="organization-lists-title">{{data.patchupReason}}</p>
          </li>
          <li class="mui-table-view-cell">
            <b>备注：</b>
            <p class="organization-lists-title">{{data.remarks}}</p>
          </li>
          <li class="mui-table-view-cell flex-between-center">
            <b>申请状态：</b>
            <span class="work-blue" :class="{'mine-lists-money':data.PAT_STATUS!=2}">{{data.PATCHUP_STATUS_}}</span>
          </li>
          <li class="mui-table-view-cell flex-between-center">
            <b>审批人：</b>
            <span class="mine-lists-content">{{data.spUserName}}</span>
          </li>
          <li class="mui-table-view-cell" v-if="data.PAT_STATUS!=2">
            <b>不同意原因：</b>
            <p class="organization-lists-title">{{data.spReason}}</p>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
  import tools from '@/utils/tools'
  import loginService from '@/service/loginService'
  export default {
    name: '',
    data () {
      return {
        fn: tools,
        data: {},
        list: [],
        id: '' // approve:审批申请，approveHistory:审批记录
      }
    },
    created () {
      this.loadData()
    },
    methods: {
      getUserName () {
        return tools.getUserInfo().partyMemberModel.name
      },
      jump (type) {
        this.$router.replace({path: '/approve/' + type})
      },
      loadData () {
        let cacheData = this.$store.state['patchApproveDetails' + this.$route.params.id]
        let partyGroupId = cacheData.PARTY_GROUP_ID_
        let data = {
          weekId: cacheData.WEEK_ID_,
          partyGroupId
        }
        loginService.getPactUpDetails(data).then((res) => {
          if (res.code === 200) {
            this.data = res.data
            this.data.PAT_STATUS = cacheData.PAT_STATUS
            this.data.PATCHUP_STATUS_ = cacheData.PATCHUP_STATUS_
          }
        })
//        this.data = this.$store.state['patchApproveDetails' + this.$route.params.id]
      },
      // 审批
      save (isTy) {
        let weekId = this.data.WEEK_ID_
        let partyGroupId = this.data.PARTY_GROUP_ID_
        let data = {
          isTy: isTy || '',
          weekId: weekId,
          partyGroupId: partyGroupId,
          token: tools.getToken()
        }
        loginService.dwbPactchUpApproval(data).then(res => {
          if (res.code !== 200) {
            return tools.tip(res.message)
          }
          tools.tip('审批提交完成')
          tools.back()
        })
      }
    },
    watch: {
      $route (to, from) {
        this.type = to.params.type
      }
    }
  }
</script>

<style scoped lang="">

</style>
